package com.ymatou.iapi.notify.service;

import com.google.common.reflect.TypeToken;
import com.ymatou.iapi.notify.parameter.NotifyResModelDto;
import com.ymatou.iapi.prodstock.parameter.FreezeProductResult;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;

import java.util.List;

/**
*获取通知列表Call
*FreeMaker Template自动生成代码
*/
public class GetMessageListByTimelineCall extends YmatouBaseCall{
	private static String opurl ="api/Message/GetMessageListByTimeline";
	
	public GetMessageListByTimelineCall() {
		super(EnvSetup.getSystemUrl("notify_iapi"),opurl,"GET","PARAM");
	}
	@Override
	public void addDefHeader() {
//		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
//		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}

	public List<NotifyResModelDto> getResults(){
		String sResults=getJsonObject().get("Result").getAsJsonArray().toString();
		List<NotifyResModelDto> NotifyResModelDtoList=(List<NotifyResModelDto>) FormatUtil.GSONToObject(sResults, new TypeToken<List<NotifyResModelDto>>(){}.getType());
		return NotifyResModelDtoList;
	}
}